package com.itheima.mysystem;

public class demo3 {
    public static void main(String[] args) {
        // arraycopy(数据源数组, 起始索引, 目的地数组, 起始索引, 拷贝个数)	数组copy
        int[] arr1 = {1, 2, 3, 4, 5};
        int[] arr2 = new int[10];

        //把arr1最后两个元素,拷贝到arr2的最后两个索引上
        System.arraycopy(arr1, arr1.length - 2, arr2, arr2.length - 2, 2);
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
    }
}
